import { Controller, Get, Post, Body, Patch, Param, Delete } from '@nestjs/common';
import { ReportManagementService } from './report-management.service';
import { CreateReportManagementDto } from './dto/create-report-management.dto';
import { UpdateReportManagementDto } from './dto/update-report-management.dto';

@Controller('report-management')
export class ReportManagementController {
    constructor(private readonly reportManagementService: ReportManagementService) { }

    @Post()
    create(@Body() createReportManagementDto: CreateReportManagementDto) {
        return this.reportManagementService.create(createReportManagementDto);
    }

    @Post('/query')
    query(@Body() body: { type: string, dateFrom: string, dateTo: string, keyword: string, pageNo: number, pageSize: number }) {
        return this.reportManagementService.findAllByPage(body);
    }

    @Post('/list')
    list(@Body() body: { dateFrom: string, dateTo: string, keyword: string }) {
        return this.reportManagementService.findAll(body);
    }

    @Get(':id')
    findOne(@Param('id') id: string) {
        return this.reportManagementService.findOne(+id);
    }

    @Patch(':id')
    update(@Param('id') id: string, @Body() updateReportManagementDto: UpdateReportManagementDto) {
        return this.reportManagementService.update(+id, updateReportManagementDto);
    }

    @Delete(':id')
    remove(@Param('id') id: string) {
        return this.reportManagementService.remove(+id);
    }
}
